package com.peng.controller;
import org.springframework.stereotype.Controller;//前后端分离
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Arrays;

//在templates目录下的所有页面，只能通过Controller来跳转！！
//需要模板引擎Thymeleaf的支持
@Controller
public class IndexController {
    @RequestMapping("/test")
    public String test(Model model){
        model.addAttribute("msg","<h1>hello,springboot</h1>");
        model.addAttribute("users", Arrays.asList("lisi","wangwu","zhangsan"));//遍历
        return "test";//跳转到test.html
    }
}
